﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="scopes">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" name="scope">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="claimTypes">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element maxOccurs="unbounded" name="claimType">
                      <xs:complexType>
                        <xs:attribute name="fullName" type="xs:anyURI" use="required" />
                        <xs:attribute name="displayName" type="xs:string" use="required" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="issuers">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element maxOccurs="unbounded" name="issuer">
                      <xs:complexType>
                        <xs:attribute name="uri" type="xs:anyURI" use="required" />
                        <xs:attribute name="displayName" type="xs:string" use="required" />
                        <xs:attribute name="thumbprint" type="xs:string" use="required" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="rules">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element maxOccurs="unbounded" name="rule">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="input">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element maxOccurs="unbounded" name="claim">
                                  <xs:complexType>
                                    <xs:attribute name="type" type="xs:string" use="required" />
                                    <xs:attribute name="value" type="xs:string" use="required" />
                                    <xs:attribute name="issuer" type="xs:string" use="required" />
                                  </xs:complexType>
                                </xs:element>
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="output">
                            <xs:complexType>
                              <xs:attribute name="type" type="xs:string" use="required" />
                              <xs:attribute name="copyFrom" use="optional" >
                                <xs:simpleType>
                                  <xs:restriction base="xs:string">
                                    <xs:enumeration value="inputIssuer" />
                                    <xs:enumeration value="inputValue" />
                                  </xs:restriction>
                                </xs:simpleType>
                              </xs:attribute>
                              <xs:attribute name="value" type="xs:string" use="optional" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute name="assertionsMatch" use="required" >
                          <xs:simpleType>
                            <xs:restriction base="xs:string">
                              <xs:enumeration value="all"/>
                              <xs:enumeration value="any"/>
                            </xs:restriction>
                          </xs:simpleType>
                        </xs:attribute>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="uri" type="xs:anyURI" use="required" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>